package com.huaixia18.systemnotice.controller;

import com.huaixia18.systemnotice.domain.ManagerSystemNotice;
import com.huaixia18.systemnotice.domain.UserSystemNotice;
import com.huaixia18.systemnotice.service.SystemNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/system-notice")
public class SystemNoticeController {

    @Autowired
    private SystemNoticeService systemNoticeService;

    // 管理员发布系统通知接口
    @PostMapping("/publish")
    public void publishSystemNotice(@RequestBody ManagerSystemNotice notice) {
        systemNoticeService.publishSystemNotice(notice);
    }

    // 用户查询系统通知接口
    @GetMapping("/user/{recipientId}")
    public List<UserSystemNotice> getUserSystemNotices(@PathVariable Long recipientId) {
        return systemNoticeService.getUserSystemNotices(recipientId);
    }
}
